<?php
namespace core\lib;
class conf
{
	public static $conf = array();
	public static function get($name,$file){
		
		$file = STUPBOY.'/core/conf/'.$file.'.php';
		if(isset(self::$conf[$file])){
			return self::$conf[$file][$name];
		}else{
			if(is_file($file)){
				$conf = include $file;
				if(isset($conf[$name])){
					self::$conf[$file] = $conf;
					return $conf[$name];
				}else{
					throw new \Exception('没有配置项'.$name);
				}
			}else{
				throw new \Exception('找不到配置文件'.$file);
			}	
		}

	}
	public static function all($file){
		$file = STUPBOY.'/core/conf/'.$file.'.php';
		if(isset(self::$conf[$file])){
			return self::$conf[$file][$name];
		}else{
			if(is_file($file)){
				$conf = include $file;
				self::$conf[$file] = $conf;
				return $conf;
			}else{
				throw new \Exception('找不到配置文件'.$file);
			}	
		}
	}
}